﻿using Little.Soldier.SWIFT;
using Little.Soldier.SWIFT.Definition;
using System.Collections.Generic;
using System.ComponentModel;

namespace Little.Soldier.SWIFT.Messages.Category9
{
  public class MT972 : SwiftMessage
  {
    private static SwiftMessageDefinition MessageDefinition;
    private static SwiftTagDefinition U0002;
    private static SwiftTagSubItemDefinition U0003;
    private static SwiftTagDefinition U0004;
    private static SwiftTagSubItemDefinition U0005;
    private static SwiftTagDefinition U0006;
    private static SwiftTagSubItemDefinition U0007;
    private static SwiftTagSubItemDefinition U0008;
    private static SwiftTagSubItemDefinition U000E;
    private static SwiftTagChoiceDefinition U000F;
    private static SwiftTagDefinition U0010;
    private static SwiftTagDefinition U0011;
    private static SwiftTagDefinition U0012;
    private static SwiftTagSubItemDefinition U0013;
    private static SwiftTagSubItemDefinition U0014;
    private static SwiftTagChoiceDefinition U0015;
    private static SwiftTagDefinition U0016;
    private static SwiftTagDefinition U0017;
    private static SwiftTagDefinition U0018;

    [Description("Transaction Reference Number")]
    public Tag20 TransactionReferenceNumber_20
    {
      get
      {
        return new Tag20((SwiftElement) this, 0, (SwiftDefinitionElement) MT972.U0002);
      }
    }

    [Description("Transaction Reference Number")]
    public Tag20 Tag20_TransactionReferenceNumber
    {
      get
      {
        return this.TransactionReferenceNumber_20;
      }
    }

    [Description("Account Identification")]
    public Tag25 AccountIdentification_25
    {
      get
      {
        return new Tag25((SwiftElement) this, 0, (SwiftDefinitionElement) MT972.U0004);
      }
    }

    [Description("Account Identification")]
    public Tag25 Tag25_AccountIdentification
    {
      get
      {
        return this.AccountIdentification_25;
      }
    }

    [Description("Statement Number/Sequence Number")]
    public MT972.Tag28C StatementNumberSequenceNumber_28C
    {
      get
      {
        return new MT972.Tag28C((SwiftElement) this, 0, (SwiftDefinitionElement) MT972.U0006);
      }
    }

    [Description("Statement Number/Sequence Number")]
    public MT972.Tag28C Tag28C_StatementNumberSequenceNumber
    {
      get
      {
        return this.StatementNumberSequenceNumber_28C;
      }
    }

    [Description("Opening Balance")]
    public Tag60F OpeningBalance_60F
    {
      get
      {
        return new Tag60F((SwiftElement) this, 0, (SwiftDefinitionElement) MT972.U0010);
      }
    }

    [Description("Opening Balance")]
    public Tag60F Tag60F_OpeningBalance
    {
      get
      {
        return this.OpeningBalance_60F;
      }
    }

    [Description("Opening Balance")]
    public Tag60M OpeningBalance_60M
    {
      get
      {
        return new Tag60M((SwiftElement) this, 0, (SwiftDefinitionElement) MT972.U0011);
      }
    }

    [Description("Opening Balance")]
    public Tag60M Tag60M_OpeningBalance
    {
      get
      {
        return this.OpeningBalance_60M;
      }
    }

    [Description("Statement Line")]
    public Tag61[] StatementLine_61
    {
      get
      {
        int index = -1;
        List<Tag61> list = new List<Tag61>();
        int count;
        do
        {
          ++index;
          Tag61 tag61 = new Tag61((SwiftElement) this, index, (SwiftDefinitionElement) MT972.U0012);
          count = this.ListTags((SwiftElement) tag61).Count;
          if (count > 0)
            list.Add(tag61);
        }
        while (count > 0);
        return list.ToArray();
      }
    }

    [Description("Statement Line")]
    public Tag61[] Tag61_StatementLine
    {
      get
      {
        return this.StatementLine_61;
      }
    }

    [Description("Closing Balance")]
    public Tag62F ClosingBalance_62F
    {
      get
      {
        return new Tag62F((SwiftElement) this, 0, (SwiftDefinitionElement) MT972.U0016);
      }
    }

    [Description("Closing Balance")]
    public Tag62F Tag62F_ClosingBalance
    {
      get
      {
        return this.ClosingBalance_62F;
      }
    }

    [Description("Closing Balance ")]
    public Tag62M ClosingBalance_62M
    {
      get
      {
        return new Tag62M((SwiftElement) this, 0, (SwiftDefinitionElement) MT972.U0017);
      }
    }

    [Description("Closing Balance ")]
    public Tag62M Tag62M_ClosingBalance
    {
      get
      {
        return this.ClosingBalance_62M;
      }
    }

    [Description("Closing Available Balance")]
    public Tag64 ClosingAvailableBalance_64
    {
      get
      {
        return new Tag64((SwiftElement) this, 0, (SwiftDefinitionElement) MT972.U0018);
      }
    }

    [Description("Closing Available Balance")]
    public Tag64 Tag64_ClosingAvailableBalance
    {
      get
      {
        return this.ClosingAvailableBalance_64;
      }
    }

    public MT972()
      : base(true)
    {
    }

    public MT972(SwiftMessage message)
      : base(message)
    {
    }

    public Tag61 AddStatementLine_61()
    {
      return new Tag61((SwiftElement) this, this.StatementLine_61.Length, (SwiftDefinitionElement) MT972.U0012)
      {
        Value = string.Empty
      };
    }

    public void RemoveStatementLine_61(Tag61 tag)
    {
      this.RemoveTag(tag.GetTag());
    }

    internal override SwiftMessageDefinition MsgDefinition()
    {
      return MT972.MessageDefinition;
    }

    protected override void InitSwiftMessageDefinition()
    {
      MT972.MessageDefinition = new SwiftMessageDefinition("MT972", "Netting Interim Statement");
      MT972.U0002 = new SwiftTagDefinition("TransactionReferenceNumber_20", "Transaction Reference Number");
      MT972.U0002.TagName = ":20:";
      MT972.U0003 = new SwiftTagSubItemDefinition("Reference", "Reference");
      MT972.U0002.Elements.Add((SwiftDefinitionElement) MT972.U0003);
      MT972.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT972.U0002);
      MT972.U0004 = new SwiftTagDefinition("AccountIdentification_25", "Account Identification");
      MT972.U0004.TagName = ":25:";
      MT972.U0005 = new SwiftTagSubItemDefinition("Account", "Account");
      MT972.U0004.Elements.Add((SwiftDefinitionElement) MT972.U0005);
      MT972.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT972.U0004);
      MT972.U0006 = new SwiftTagDefinition("StatementNumberSequenceNumber_28C", "Statement Number/Sequence Number");
      MT972.U0006.TagName = ":28C:";
      MT972.U0007 = new SwiftTagSubItemDefinition("StatementNumber", "Statement Number");
      MT972.U0006.Elements.Add((SwiftDefinitionElement) MT972.U0007);
      MT972.U0008 = new SwiftTagSubItemDefinition("Sequence_Number", "Sequence Number");
      MT972.U0008.Mandatory = false;
      MT972.U000E = new SwiftTagSubItemDefinition("SequenceNumber", "Sequence Number");
      MT972.U0008.Elements.Add((SwiftDefinitionElement) MT972.U000E);
      MT972.U0006.Elements.Add((SwiftDefinitionElement) MT972.U0008);
      MT972.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT972.U0006);
      MT972.U000F = new SwiftTagChoiceDefinition("Choice", "");
      MT972.U000F.Multiple = true;
      MT972.U0010 = new SwiftTagDefinition("OpeningBalance_60F", "Opening Balance");
      MT972.U0010.TagName = ":60F:";
      MT972.U000F.Elements.Add((SwiftDefinitionElement) MT972.U0010);
      MT972.U0011 = new SwiftTagDefinition("OpeningBalance_60M", "Opening Balance");
      MT972.U0011.TagName = ":60M:";
      MT972.U000F.Elements.Add((SwiftDefinitionElement) MT972.U0011);
      MT972.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT972.U000F);
      MT972.U0012 = new SwiftTagDefinition("StatementLine_61", "Statement Line");
      MT972.U0012.TagName = ":61:";
      MT972.U0012.Mandatory = false;
      MT972.U0012.Multiple = true;
      MT972.U0013 = new SwiftTagSubItemDefinition("StatementLine", "Statement Line");
      MT972.U0012.Elements.Add((SwiftDefinitionElement) MT972.U0013);
      MT972.U0014 = new SwiftTagSubItemDefinition("Supplementarydetails", "Supplementary Details");
      MT972.U0014.Mandatory = false;
      MT972.U0012.Elements.Add((SwiftDefinitionElement) MT972.U0014);
      MT972.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT972.U0012);
      MT972.U0015 = new SwiftTagChoiceDefinition("Choice", "");
      MT972.U0015.Multiple = true;
      MT972.U0016 = new SwiftTagDefinition("ClosingBalance_62F", "Closing Balance");
      MT972.U0016.TagName = ":62F:";
      MT972.U0015.Elements.Add((SwiftDefinitionElement) MT972.U0016);
      MT972.U0017 = new SwiftTagDefinition("ClosingBalance_62M", "Closing Balance ");
      MT972.U0017.TagName = ":62M:";
      MT972.U0015.Elements.Add((SwiftDefinitionElement) MT972.U0017);
      MT972.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT972.U0015);
      MT972.U0018 = new SwiftTagDefinition("ClosingAvailableBalance_64", "Closing Available Balance");
      MT972.U0018.TagName = ":64:";
      MT972.U0018.Mandatory = false;
      MT972.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT972.U0018);
    }

    public class Tag28C : SwiftTagWrapper
    {
      public string Value
      {
        get
        {
          return this.GetValue();
        }
        set
        {
          this.SetValue("28C", value);
        }
      }

      internal Tag28C(SwiftElement parent, int index, SwiftDefinitionElement definition)
        : base(parent, index, definition)
      {
      }
    }
  }
}
